<?php
class Knowledges_type_content_Model extends ORM
{
	protected $table_name = 'knowledges_type_content';
	protected $primary_key = 'knowledges_type_content_id'; 
	protected $col_knowledges_type_id = 'knowledges_type_id';
	protected $col_language_id = 'languages_id';
	protected $sorting = array('knowledges_type_content_id' => 'desc');
	
	public function get($knowledges_type_id='',$language_id='')
	{
		$this->db->select('*');
		$this->db->from($this->table_name);		
		$this->db->orderby($this->primary_key,'desc');
		if($knowledges_type_id) $this->db->where($this->col_knowledges_type_id,$knowledges_type_id);
		if($language_id) $this->db->where($this->col_language_id,$language_id);
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_knowledges_type()
	{
		$this->db->select('*');
		$this->db->from('knowledges_type');
		$this->db->join('knowledges_type_content','knowledges_type.knowledges_type_id','knowledges_type_content.knowledges_type_id');
		$this->db->where('knowledges_type_status',1);
		$this->db->orderby('knowledges_type_sort_order','desc');	
		$this->db->orderby($this->primary_key,'desc');	
		$query = $this->db->get();
		return $query->result_array(false);
	}
}